{include file="public/headerbase" /} {include file="public/left" /}
<div class="right-content">
	<ol class="breadcrumb we7-breadcrumb">
		<li>
			<a href="{:url('Banner/index')}">图片展示</a>
		</li>
		<li>
			添加图片
		</li>
	</ol>
	<div class="clearfix">
		<form action="{:url('Banner/addxinx')}" method="post" class="we7-form" role="form" id="form1" enctype="multipart/form-data">
			
			<div class="form-group">
				<label class="col-sm-2 control-label">图片</label>
				<div class="col-sm-8">
				<input type="file" name="bimg" id="file0" multiple="multiple" style="display: inline-block;" />
				<span style="color: red;margin-left: 50px ">*图片尺寸750*425</span>
				<br><img src="__PUBLIC__/images/img.jpg" id="img0" style="height:100px;">
				</div>
			</div>
			<div class="form-group">
				<div class="">
					<input type="submit" class="btn btn-primary" value="提交" />
				</div>
			</div>
		</form>
	</div>
	<script>
	// $(function(){
	// 	$('#form1').submit(function(){
	// 		if(!$.trim($(':text[name="burl"]').val())) {
	// 			util.message('请填写链接', '', 'error');
	// 			return false;
	// 		}
	// 		return true;
	// 	});
	// });
		$("#file0").change(function(){
			var objUrl = getObjectURL(this.files[0]) ;
			console.log("objUrl = "+objUrl) ;
			if (objUrl) {
			$("#img0").attr("src", objUrl) ;
			}
		}) ;
		//建立一個可存取到該file的url
		function getObjectURL(file) {
			var url = null ; 
			if (window.createObjectURL!=undefined) { // basic
				url = window.createObjectURL(file) ;
			} else if (window.URL!=undefined) { // mozilla(firefox)
				url = window.URL.createObjectURL(file) ;
			} else if (window.webkitURL!=undefined) { // webkit or chrome
				url = window.webkitURL.createObjectURL(file) ;
			}
			return url ;
		}
	</script>
</div>
</div>
</div>
</div>
</div>
{include file="public/footer" /}